<?php
global $_W,$_GPC;
$query = load()->object('query');
$pageindex = max(1,intval($_GPC['page']));
$contion = "weid = :weid";
$psize = 10;
$params = array(':weid'=>$_W['uniacid']);
$admin_username = trim($_GPC['admin_username']);
if($admin_username != ''){
    $contion .= " AND admin_username LIKE :admin_username";
    $params[':admin_username'] = "%".$admin_username."%";
}
$log_type = intval($_GPC['log_type']);
if($log_type >= 1){
    $contion .= " AND log_type = :log_type";
    $params[':log_type'] = $log_type;
}

if(!empty($_GPC['time'])){
    $starttime = strtotime($_GPC['time']['start']);
    $endtime = strtotime($_GPC['time']['end']) +86399;
    $contion .= " AND addtime >= :starttime AND addtime <= :endtime";
    $params[':starttime'] = $starttime;
    $params[':endtime'] = $endtime;
}else{
    $starttime = strtotime('-1 month');
    $endtime = time();
}
$sysloglist = pdo_fetchall("SELECT * FROM ".tablename('goouc_class_syslog')." WHERE ".$contion." ORDER BY `addtime` DESC LIMIT ".($pageindex - 1)*$psize.",".$psize,$params);
$total = pdo_fetchcolumn("SELECT count(*) FROM ".tablename('goouc_class_syslog')." WHERE ".$contion,$params);
$page = pagination($total,$pageindex,$psize);
include $this->template('web/syslog');
?>